# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=openwebrx
pkgver=1.2.2.r389.g640c5b0
pkgrel=4
pkgdesc='Open source, multi-user SDR receiver software with a web interface.'
arch=('any')
groups=('blackarch' 'blackarch-radio')
url='https://github.com/jketterl/openwebrx'
license=('AGPL-3.0-only')
depends=('python' 'python-pycsdr' 'csdr' 'airspyhf' 'libsdrplay' 'rtl-sdr'
         'python-js8py' 'owrx_connector' 'netcat')
makedepends=('git' 'python-setuptools')
optdepends=('sox' 'mbelib' 'digiham' 'dsd' 'codec2' 'direwolf')
backup=('etc/openwebrx/openwebrx.conf')
source=("git+https://github.com/jketterl/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  ( set -o pipefail
    git describe --long --tags --abbrev=7 2>/dev/null |
      sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "%s.%s" "$(git rev-list --count HEAD)" \
      "$(git rev-parse --short=7 HEAD)"
  )
}

build() {
  cd $pkgname

  python setup.py build
}

package() {
  cd $pkgname

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  install -Dm 644 openwebrx.conf "$pkgdir/etc/openwebrx/openwebrx.conf"
  install -Dm 644 systemd/openwebrx.service \
    "$pkgdir/usr/lib/systemd/system/openwebrx.service"
  install -dm 755 "$pkgdir/var/lib/openwebrx"
}

